using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop.Member;
using System;
using System.Collections;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
public class Member_Shop_MyAuctionProduct : Member, IRequiresSessionState
{
	protected ScriptManager ScriptManager1;
	protected Literal buy_type;
	protected Button Bidding;
	protected Button Bided;
	protected GridView GridView1;
	protected PlaceHolder ListPanel;
	protected GridView GridView2;
	protected PlaceHolder RecordPanel;
	private string wherestr = "";
	private ArrayList al = new ArrayList();
	private IDbDataParameter[] param = null;
	private Shop_Order _order = null;
	private int mtype = 0;
	private string m_action = "";
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected Shop_Order m_order
	{
		get
		{
			Shop_Order order;
			if (this._order == null)
			{
				this._order = new Shop_Order(this.conn);
				order = this._order;
			}
			else
			{
				order = this._order;
			}
			return order;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		this.mtype = Fetch.GetID("type");
		this.m_action = Fetch.Get("action");
		if (this.mtype != 1)
		{
			this.mtype = 0;
		}
		if (!base.IsPostBack)
		{
			if (this.m_action.ToLower() == "record")
			{
				this.RecordPanel.Visible = true;
				this.ListPanel.Visible = false;
				this.BindRecordList();
			}
			else
			{
				this.RecordPanel.Visible = false;
				this.ListPanel.Visible = true;
				this.BindList();
			}
		}
	}
	protected void BindList()
	{
		this.QuestString();
		if (this.al.Count > 0)
		{
			this.param = new IDbDataParameter[this.al.Count];
			this.al.CopyTo(this.param, 0);
		}
		Shop_Product shop_Product = new Shop_Product(this.conn);
		if (this.param == null)
		{
			this.GridView1.DataSource = shop_Product.GetAuctionProduct(base.user.UserID, this.mtype, this.wherestr, new IDbDataParameter[0]);
		}
		else
		{
			this.GridView1.DataSource = shop_Product.GetAuctionProduct(base.user.UserID, this.mtype, this.wherestr, this.param);
		}
		this.GridView1.DataBind();
	}
	protected void BindRecordList()
	{
		int iD = Fetch.GetID("productid");
		if (iD == 0)
		{
			this.WriteErrMsg("", Language.Get("Common/LostParam", "productid"), "");
		}
		Shop_Order shop_Order = new Shop_Order(this.conn);
		this.GridView2.DataSource = shop_Order.GetBuyerAuctionOrderByProductID(iD, base.user.UserID);
		this.GridView2.DataBind();
	}
	protected void QuestString()
	{
		if (this.wherestr != "")
		{
			this.wherestr = "and" + this.wherestr;
			this.wherestr = this.wherestr.Replace("andand", "Where");
		}
	}
	protected string GetStatus(int MoneyReceipt, string str)
	{
		int iD = Fetch.GetID("productid");
		decimal d = (decimal)this.conn.GetScalar("Select TempSubScriptionRate From [HLShop_Product] Where productid=" + iD, new IDbDataParameter[0]);
		string memberMsg;
		if (MoneyReceipt <= 0 && d > 0m)
		{
			memberMsg = Language.GetMemberMsg("Order/Auction/Status/Status3", new string[0]);
		}
		else
		{
			if (str == "1")
			{
				memberMsg = Language.GetMemberMsg("Order/Auction/Status/Status1", new string[0]);
			}
			else
			{
				memberMsg = Language.GetMemberMsg("Order/Auction/Status/Status0", new string[0]);
			}
		}
		return memberMsg;
	}
	public string GetStrStatus(string rowsPrice, string Cycle)
	{
		int iD = Fetch.GetID("productid");
		DataSet dataSet = this.conn.GetDataSet(string.Concat(new object[]
		{
			"select AuctionEndPrice from HLShop_Order where AuctionEndPrice in(select max(AuctionEndPrice) from HLShop_Order as a, HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID and Cycle=",
			int.Parse(Cycle),
			" and b.ProductID=",
			iD,
			")"
		}));
		string result;
		if (decimal.Parse(rowsPrice) >= decimal.Parse(dataSet.Tables[0].Rows[0]["AuctionEndPrice"].ToString()))
		{
			result = "领先<img src='../Images/okhank.gif'></img>";
		}
		else
		{
			result = "出局";
		}
		return result;
	}
}
